package lab02.Test13;

public class Gymnastics extends ComputerAverage {

    double sum = 0;
    double a;
    double b;
    double m=0;
    //去掉一个最低分，去掉一个最高分
    @Override
    double average(double[] scores) {
        a = scores[0];
        b = scores[0];

        for (int i= 0;i<scores.length;i++){

            if (scores[i] > a) {
                a = scores[i];
            }
            if (scores[i] < b) {
                b = scores[i];
            }

            sum += scores[i];
        }
       m= (sum - a - b) / (scores.length - 2);
        return m;
    }

    @Override
    public String toString() {
        return m+"";
    }
}
